package sg.edu.nus.iss.cats.action;

import javax.servlet.http.*;
import org.apache.struts.action.*;

import sg.edu.nus.iss.cats.model.*;
import sg.edu.nus.iss.cats.controller.*;

public class EmployeeListAction extends Action {

	public ActionForward execute(ActionMapping mapping,
								 ActionForm form,
								 HttpServletRequest request,
								 HttpServletResponse response) {

		System.out.println("EmployeeListAction");

		//Get employees from UserSession
		HttpSession session = request.getSession();
		UserSession userSession =
			(UserSession) session.getAttribute("USERSESSION");
		Employee[] subordinates = userSession.getSubordinates();
		request.setAttribute("subordinateEmployees", subordinates);

		return mapping.findForward("success");
	}
}